<!--引入头部文件-->
<include file="./Public/Admin/Index/top.html" />

<!--左侧导航-->
<include file="./Public/Admin/Index/left.html" />
<style>
    .wrap{
        width: 260px;
        height: 80px;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
    }
</style>
    <!--/sidebar-->
    <div class="main-wrap">
        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="/jscss/admin/design/">首页</a><span class="crumb-step">&gt;</span><a class="crumb-name" href="/jscss/admin/design/">博文管理</a><span class="crumb-step">&gt;</span><span>博文列表</span></div>
        </div>
        <div class="search-wrap">
            <div class="search-content">
                <form action="#" method="get" enctype="multipart/form-data">
                    <table class="search-tab">
                        <tr>
                            <th width="120">分类:</th>
                            <td>
                                <select name="search-sort" id="">
                                    <option value="">全部</option>
                                    <option value="19">WEB开发</option><option value="20">推荐界面</option>
                                </select>
                            </td>

                            <th width="70">标题:</th>
                            <td><input class="common-text" placeholder="关键字" name="keywords" value="{$keywords}" type="text" ></td>

                            <th width="70">标签:</th>
                            <td>
                                <select name="search-sort" id="">
                                    <option value="">全部</option>
                                    <option value="19">php</option><option value="20">mysql</option>
                                </select>
                            </td>
                            <td><input class="btn btn-primary btn2" name="sub" value="查询" type="submit"></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
        <div class="result-wrap">
            <form name="myform" id="myform" method="post">
                <div class="result-title">
                    <div class="result-list">
                        <a href="{:U('Insert/doinsert')}"><i class="icon-font"></i>新增分类</a>
                        <a id="batchDel" href="javascript:void(0)"><i class="icon-font"></i>批量删除</a>
                        <a id="updateOrd" href="javascript:void(0)"><i class="icon-font"></i>更新排序</a>
                        <a href="javascript:void(0)" onclick="clickAll()">╋全选</a>
                        <a href="javascript:void(0)" onclick="notAll()">╬反选</a>
                    </div>
                </div>
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
                            <th class="tc" width="5%"><input class="allChoose" id="" name="" type="checkbox" onclick="all()"></th>
                            <th id="AAA">ID</th>
                            <th id="AAA">标题</th>
                            <th id="AAA">logo</th>
                            <th id="AAA">内容</th>
                            <th id="AAA">点击</th>
                            <th id="AAA">发布人</th>
                            <th id="AAA">更新时间</th>
                            <th id="AAA">评论</th>
                            <th id="AAA">操作</th>
                        </tr>
                        <volist name="list" id="val">
                        <tr>
                            <td class="tc"><input type="checkbox" name="clickBox" value="{$val.id}"></td>
                            <td class="tc">{$val.id}</td>
                            <td class="tc"><a href="{:U('Design/lists')}?id={$val.id}">{$val.title}</a></td>
                            <td class="tc"><img src="__ROOT__/{$val.img1}" alt="1" width="50"></td>
                            <td class="tc" width="100" style="height: 80px"><div class="wrap">{$val.uname}</div></td>
                            <td class="tc">
                                <button class="praise" id="{$val.id}">点赞</button>
                                <span id="num"><font color="blue">({$val.num})</font></span>
                            </td>
                            <td class="tc">{$val.author}</td>
                            <td class="tc">{$val.time}</td>+
                            <td class="tc"><a href="{:U('Zhangjie/dodesign',array('t_id'=>$val['t_id']))}">更新</a></td>
                            <td>
                                <a class="link-update" href="{:U('Design/todesign')}">修改</a>
                                <a class="link-del" href="{:U('Design/delete',array('id'=>$val['id']))}" onclick='if(!confirm("确认删除么?")){return false;}'>删除</a>
                            </td>
                        </tr>
                        </volist>
                    </table>
                    <div class="list-page">{$page}</div>
                </div>
            </form>
        </div>
    </div>
    <!--/main-->
</div>
</body>
<script>
//    //全选反选
//    $("input[name='all']").click(function(){
//        $("input[name='all2']").prop("checked",$("input[name='all']").prop("checkde"));
//    })

//全选
function clickAll() {
    var checkBox = document.getElementsByName('clickBox');
    if (checkBox[0].checked==true){
        for (i=0;i<checkBox.length;i++){
            checkBox[i].checked=false;
        }
        return;
    }
    for (i=0;i<checkBox.length;i++){
        checkBox[i].checked='checkde';
    }
}

//反选
function notAll() {
    var checkBox = document.getElementsByName('clickBox');
    for (i=0; i<checkBox.length;i++) {
        if (checkBox[i].checked== true) {
            checkBox[i].checked = false;
        }else{
            checkBox[i].checked = 'checkde';
        }
    }
}
</script>
<script src="__ROOT__/Public/jquery.1.12.js"></script>
<script>
    $(".praise").click(function(){
        //alert(111);
        var id = $(this).attr('id');
        $.ajax({
            type:"post",
            url :"{:U('Design/praise')}",
            data:{id:id},
            success:function(msg){
                if(msg == 'no'){
                    num.innerHTML="<font color='red'>您已经点赞过啦！</font>"
                }else if(msg == 'error'){
                    num.innerHTML="<font color='red'>点赞失败！</font>"
                }else{
                    $("#num").html((msg));
                }
            }
        });
    })
</script>
</html>
